home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
pc
/
data
/
menu_dvd.swf
/
scripts
/
__Packages
/
HtmlMenuCellRenderer.as
< prev
next >
Wrap
Text File
|
2007-11-07
|
3KB
|
89 lines
class HtmlMenuCellRenderer extends mx.core.UIComponent
{
static var style_sheet = null;
static var USE_EMBEDDED_FONT = true;
var previousLabel = null;
function HtmlMenuCellRenderer()
{
super();
this.cssStyle = "menuRowText";
}
function createChildren(Void)
{
if(HtmlMenuCellRenderer.CssUrl != undefined && HtmlMenuCellRenderer.style_sheet == null)
{
HtmlMenuCellRenderer.style_sheet = new TextField.StyleSheet();
HtmlMenuCellRenderer.style_sheet.load(HtmlMenuCellRenderer.CssUrl);
}
if(this.htmlComponent == undefined)
{
this.createLabel("htmlComponent",1);
}
this.htmlComponent.html = true;
this.htmlComponent.embedFonts = HtmlMenuCellRenderer.USE_EMBEDDED_FONT;
this.htmlComponent.border = false;
this.htmlComponent.multiline = false;
this.htmlComponent.wordWrap = false;
this.htmlComponent.selectable = false;
this.htmlComponent.styleSheet = HtmlMenuCellRenderer.style_sheet;
this._parent.drawRowFill = this.drawRowFill;
this.size();
}
function size(Void)
{
this.htmlComponent.setSize(this.__width,this.__height - 2);
var deltaY = 2;
this.htmlComponent._y = deltaY;
}
function setValue(str, item, sel)
{
if(item == undefined)
{
this.htmlComponent.htmlText = str;
this.previousLabel = null;
return undefined;
}
var columnIndex = this.columnIndex;
var columnName = this.getDataLabel();
var htmlTxt = str;
var labelSupSub = this.HtmlFunction(item.label);
htmlTxt = "<span class=\'" + this.cssStyle + "\'>" + labelSupSub + "</span>";
this.htmlComponent.htmlText = htmlTxt;
}
function getPreferredHeight(Void)
{
if(this.owner == undefined)
{
return 18;
}
return this.owner.__height;
}
function HtmlFunction(inLabel)
{
if(inLabel.indexOf("<sup>") >= 0 || inLabel.indexOf("<sub>") >= 0)
{
return StringUtils.subSupFromHTML(inLabel);
}
return inLabel;
}
function setColor(col)
{
if(this.htmlComponent != undefined)
{
this.htmlComponent.textColor = col;
}
}
function drawRowFill(mc, newClr)
{
mc.clear();
mc.beginFill(16777215);
mc.drawRect(0,0,this.__width,this.__height);
mc.beginFill(newClr);
mc.drawRect(0,1,this.__width,this.__height);
mc.endFill();
mc._width = this.__width;
mc._height = this.__height;
mc._alpha = 90;
}
}